package com.coolingme.springcloud.nacos;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Nacos配置中心测试
 * RefreshScope: 表示当前类中的属性需要动态刷新
 *
 * @author wangyue
 * @date 2022/10/05 15:51
 */
@RefreshScope
@RestController
public class NacosConfigController {

    /**
     * 冒号后面表示默认值
     */
    @Value("${info:World}")
    private String info;

    @GetMapping("/info")
    public String getInfo() {
        return "Hello " + info;
    }

}
